<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商品信息列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <p>销售状态：</p>-->
<!--                                <select name="salesStatus" class="form-control">-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <p>库存状态：</p>-->
<!--                                <select name="stockStatus" class="form-control">-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
<!--                            </li>-->
                            <li>
                                <p>单价：</p>
                                <input type="text" name="purchasePrice"/>
                            </li>
                            <li>
                                <p>库存类型：</p>
                                <select name="productType" class="form-control" th:with="type=${@dict.getType('product_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>面值：</p>
                                <input type="text" name="faceValue"/>
                            </li>
                            <li>
                                <p>商品名称：</p>
                                <input type="text" name="productName"/>
                            </li>
                            <li>
                                <p>商品Id：</p>
                                <input type="text" name="productId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="fulu:product:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="fulu:product:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="fulu:product:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-success" onclick="synchron()" shiro:hasPermission="weixin:user:edit">
                    <i class="fa fa-refresh"></i> 同步商品列表
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="fulu:product:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('fulu:product:edit')}]];
        var removeFlag = [[${@permission.hasPermi('fulu:product:remove')}]];
        var prefix = ctx + "fulu/product";

        $(function() {
            var options = {
                url: prefix + "/list",
                // createUrl: prefix + "/add",
                // updateUrl: prefix + "/edit/{productId}",
                // removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "商品信息",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'productId',
                    title : '商品Id'
                },
                {
                    field : 'productName',
                    title : '商品名称'
                },
                {
                    field : 'productType',
                    title : '库存类型'
                },
                {
                    field : 'faceValue',
                    title : '面值'
                },
                {
                    field : 'purchasePrice',
                    title : '单价'
                },
                {
                    field : 'salesStatus',
                    title : '销售状态'
                },
                {
                    field : 'stockStatus',
                    title : '库存状态'
                },
                {
                    field : 'details',
                    title : '商品详情'
                },

                {
                    field : 'templateId',
                    title : '商品模板Id',
                    visible: false
                },


                {
                    field : 'fourCategoryIcon',
                    title : '四级分类图标',
                    visible: false
                }
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.details + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.details + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
                ]
            };
            $.table.init(options);
        });
        function synchron() {
            $.modal.confirm("同步商品需要一定时间，商品越多、用时越久，请耐心等待，勿重复提交；确认此操作吗?", function() {
                $.operate.post(prefix + "/syncProductInfo");
            })
        }
    </script>
</body>
</html>